package com.lucy.property.entity;

import com.lucy.common.core.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.checkerframework.checker.units.qual.C;
import org.hibernate.Hibernate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Objects;

@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Entity
@Table(name = "house_ship")
@ApiModel(value = "房产实体类")
public class HouseShip extends BaseEntity implements Serializable {

    @ApiModelProperty("房产ID")
    @Column(name = "house_id")
    private String houseId;

    @ApiModelProperty("用户ID")
    @Column(name = "user_id")
    private Long userId;

    @ApiModelProperty("房产关系")
    @Column(name = "house_ship")
    private String houseShip;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
        HouseShip houseShip = (HouseShip) o;
        return getId() != null && Objects.equals(getId(), houseShip.getId());
    }

    @Override
    public int hashCode() {
        return getClass().hashCode();
    }
}
